/* GUI CONVERTED from rsscdela.p (converter v1.76) Mon Jul  8 15:27:41 2002 */
/* rsscdela.p - Release Management Supplier Schedules                   */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*V8:ConvertMode=Report                                                 */
/* $Revision: 1.6.1.6 $                                                 */
/* REVISION: 7.3      LAST MODIFIED: 10/16/92   BY: WUG *G462*          */
/* REVISION: 8.6      LAST MODIFIED: 03/18/97   BY: *K080* Kieu Nguyen  */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane    */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan   */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan   */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb              */
/* Old ECO marker removed, but no ECO header exists *F0PN*                  */
/* Revision: 1.6.1.3   BY: Tiziana Giustozzi  DATE: 05/24/02  ECO: *P03Z*   */
/* $Revision: 1.6.1.6 $        BY: Tiziana Giustozzi DATE: 06/20/02  ECO: *P093*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/
/* SHIPPER ARCHIVE/DELETE SUBPROGRAM */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdeclre.i}
{apconsdf.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

define input parameter abs_recid as recid.
define input parameter indent_ct as integer.

define shared variable rdelete like mfc_logical label "Delete".
define shared variable archive like mfc_logical label "Archive" initial yes.
define shared frame c.
define shared stream history.
define variable ctype        as character label "T" format "x(1)".
define variable disp_abs_id  as character.
define variable indent_id    as character format "x(20)" label "ID".
define variable par_shipfrom as character.
define variable par_id       as character.

FORM /*GUI*/ 
   indent_id    format "x(20)"
   abs_item     column-label "Item Number"
   scx_po       format "x(8)"
   scx_line
   abs_qty      format "->,>>>,>>9.9<<<<<<<<"
   abs_site
   abs_loc
   abs_lotser
   abs_ref
with STREAM-IO /*GUI*/  frame c down width 132 attr-space.

/* SET EXTERNAL LABELS */
setFrameLabels(frame c:handle).

find abs_mstr where recid(abs_mstr) = abs_recid no-lock.

indent_id = substring("...........",1,indent_ct)
          + if abs_id begins "i" then "I" else abs_id.

find pod_det
   where pod_nbr = abs_order
     and pod_line = integer(abs_line)
no-lock no-error.

display
   indent_id
   abs_item
   pod_nbr when (available pod_det) @ scx_po
   ""      when (not available pod_det) @ scx_po
   string(integer(abs_line),">>>9") format "x(4)"
           when (available pod_det) @ scx_line
   abs_qty when (abs_qty <> 0)
   abs_site
   abs_loc
   abs_lotser
   abs_ref
with frame c STREAM-IO /*GUI*/ .

down 1 with frame c.

assign
   par_shipfrom = abs_shipfrom
   par_id       = abs_id
   abs_recid    = recid(abs_mstr).

for each abs_mstr no-lock
   where abs_shipfrom = par_shipfrom
     and abs_par_id = par_id:
   {gprun.i ""rsscdela.p"" "(input recid(abs_mstr), input (indent_ct + 1))"}
end.

if rdelete then do:
   find abs_mstr where recid(abs_mstr) = abs_recid exclusive-lock.

   /* DELETE LOGISTICS ACCOUNTING LACD_DET DETAIL RECORDS */
   for each lacd_det
      where lacd_det.lacd_internal_ref_type = {&TYPE_POShipper}
      and lacd_det.lacd_internal_ref = substring(abs_id,2)
      and lacd_shipfrom = abs_shipfrom
      exclusive-lock:

      if archive then do:
         export stream history "lacd_det".
         export stream history lacd_det.
      end.

      delete lacd_det.

   end. /* FOR EACH lacd_det */

   if archive then do:
      export stream history "abs_mstr".
      export stream history abs_mstr.
   end.

   delete abs_mstr.
end.
